package com.example.codefilter.framework.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;

/**
 * @version 1.0.0
 * @className: MybatisPlusConfig
 * @description: MybatisPlusConfig配置
 * @author: LiJunYi
 * @create: 2022/7/25 17:27
 */
@MapperScan("com.example.codefilter.project.sys.dao")
public class MybatisPlusConfig
{
    /**
     * 新的分页插件,一缓和二缓遵循mybatis的规则,
     *
     * @return {@link MybatisPlusInterceptor}
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
